<template>
  <div id="pageTop">
    <div class="top">
      <div class="left">
        <img src="../assets/img/logo.png" />
        <h1>综合一窗受理平台</h1>
      </div>
      <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
        <template v-for="item in NavigateItem">
          <el-submenu v-if="item.items && item.items.length" :index="item.key" :key="item.key">
            <template slot="title">{{ item.title }}</template>
            <template v-for="it in item.items">
              <el-submenu v-if="it.items && item.items.length" :index="it.key" :key="it.key">
                <template slot="title">{{ it.title }}</template>
                <el-menu-item v-for="(third, key) in it.items" :key="key" :index="third.key">
                  {{ third.title }}
                </el-menu-item>
              </el-submenu>
              <el-menu-item v-else :index="it.key" :key="it.key">{{ it.title }}</el-menu-item>
            </template>
          </el-submenu>
          <el-menu-item v-else :index="item.key" :key="item.key" @click="trunTo(item)">{{ item.title }}</el-menu-item>
        </template>
        <el-menu-item class="test-cls" index="2" style="transition: none">帮助中心</el-menu-item>
        <el-menu-item class="test-cls" @click="loginOut" index="3" style="transition: none">退出登录</el-menu-item>
        <h2>
          综窗01
          <br />
          <span>业务人员</span>
        </h2>
        <el-avatar :size="35" :src="circleUrl"></el-avatar>
      </el-menu>
    </div>
    <!-- <implementList :visible.sync="visible.implementList" /> -->
  </div>
</template>
<script>
  import { loginOut } from '@/api/login/loginApi';
  export default {
    name: 'PageTop',
    data() {
      return {
        circleUrl: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
        sizeList: ['large', 'medium', 'small'],
        activeIndex: '1',
        activeIndex2: '1',
        // visible: { implementList: false },
        strArr: [
          { title: '组织用户管理', obj: [{ title1: '区划管理' }, { title1: '机构管理' }, { title1: '员工管理' }] },
          {
            title: '事项管理',
            obj: [
              {
                title1: '目录清单管理',
                arrArr: [
                  { text: '目录清单导入', path: '/tabulation/listContents' },
                  { text: '目录清编制', path: '/tabulation/compileContents' },
                  { text: '目录清单审核', path: '/tabulation/auditContents' },
                  { text: '目录清单发布', path: '/tabulation/releaseContents' },
                  { text: '目录清单认领', path: '/tabulation/toClaimContents' },
                  { text: '目录清单认领审核', path: '/tabulation/toClaimAuditContents' },
                  { text: '目录清单动态管理', path: '/tabulation/dynamicMaContents' },
                  { text: '目录清单已认领', path: '/tabulation/listContents' }
                ]
              },
              { title1: '实施清单管理' },
              { title1: '情形管理' },
              { title1: '一件事管理' },
              { title1: '通办管理' }
            ]
          },
          { title: '权限管理' }
        ],
        NavigateItem: [
          {
            title: '事项管理',
            key: '10',
            path: '/itemManage'
          },
          {
            title: '一件事管理',
            key: '11',
            path: '/oneThingManage'
          },
          {
            title: '通办管理',
            key: '12',
            path: '/oneThingCrossRule'
          },
          {
            title: '情形管理',
            key: '13',
            path: '/situationList'
          },
          {
            title: '材料管理',
            key: '14',
            path: '/materials'
          }
        ]
      };
    },
    methods: {
      handleSelect(key, keyPath) {
        console.log(key, keyPath);
      },
      // 退出登录
      async loginOut() {
        const data = await loginOut();
        if (data.data.success) {
          this.$router.push({ path: '/login' });
          this.clearInitUserData();
        }
      },
      trunTo(item) {
        this.$router.push({ path: item.path });
      }
    }
  };
</script>

<style lang="scss">
  #pageTop {
    width: 100%;
    height: 90px;
    h2 {
      font-size: 16px;
      font-weight: bold;
      line-height: 22px;
      color: #ffffff;
      span {
        font-size: 14px;
        font-family: PingFang SC;
        font-weight: 500;
        line-height: 20px;
      }
    }
    .el-avatar {
      float: right;
      margin-top: -40px;
    }
    .top {
      width: 1860px;
      height: 44px;
      display: flex;
      padding-top: 20px;
      justify-content: space-between;
      .left {
        width: 242px;
        height: 40px;
        margin-left: 30px;
        display: flex;
        justify-content: space-between;
        h1 {
          width: 192px;
          height: 33px;
          font-size: 22px;
          font-weight: bold;
          line-height: 40px;
          color: #ffffff;
          opacity: 1;
        }
      }
      .el-menu--horizontal .el-menu-item:not(.is-disabled):focus,
      .el-menu--horizontal .el-menu-item:not(.is-disabled):hover {
        color: $blue;
        background: #ffffff;
        border-radius: 20px;
      }
      .el-menu {
        width: 923px;
        height: 44px;
        background: rgba(0, 0, 0, 0);
        border: none;
        .el-menu-item {
          height: 44px;
          line-height: 44px;
          font-size: 16px;
          color: #ffff;
        }
        .el-menu-item:hover {
          color: $blue;
          background: #ffffff;
          border-radius: 20px;
          // opacity: 1;
        }
      }
      .el-menu--horizontal > .el-submenu .el-submenu__title {
        height: 44px;
        line-height: 44px;
        font-size: 16px;
        border: none;
        transition: none;
        opacity: 1;
        color: #ffff;
      }
      .el-submenu__title:hover {
        text-align: center;
        border-bottom: none;
        background: #ffffff !important;
        color: $blue !important;
        border-radius: 20px;
      }
    }
  }
  .el-submenu .el-menu-item {
    min-width: 120px;
  }
  .test-cls:focus,
  .test-cls:hover {
    height: 44px;
    text-align: center;
    border-bottom: none;
    background: #ffffff !important;
    color: $blue !important;
    border-radius: 20px;
  }

  .el-menu--horizontal {
    width: 0;
    margin-top: 5px;
    margin-left: 5px;
    background: #ffffff;
    box-shadow: 0px 5px 10px rgba(28, 108, 191, 0.3);
    opacity: 0.9;
    text-align: center;
    border-radius: 10px;
    box-shadow: none;
  }
  .el-menu--popup {
    width: 100%;
    min-width: 120px;
    height: 100%;
    border-radius: 10px;
    box-shadow: none;
  }

  .el-menu--horizontal .el-menu-item:not(.is-disabled):hover {
    color: $blue;
  }
  .el-menu--horizontal .el-menu .el-submenu__title:hover {
    color: $blue;
  }
</style>
